<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>OpenShoe: User (USB) interface</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">OpenShoe
   &#160;<span id="projectnumber">1.0</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a>  </div>
  <div class="headertitle">
<div class="title">User (USB) interface</div>  </div>
<div class="ingroups"><a class="el" href="group__openshoe__runtime__framework.html">OpenShoe runtime framework</a></div></div>
<div class="contents">

<p>This group contains high level functions for communication between user and system.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><b>rxtx_buffer</b></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Receive and transmit buffer. <br/></td></tr>
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__user__interface.html#ga87a9b575684eea3d1a804e597236b40f">com_interface_init</a> (void)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialization function for communication interface.  <a href="#ga87a9b575684eea3d1a804e597236b40f"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__user__interface.html#ga328bb6c7a4ed590a8a4eb1b2a60943f1">receive_command</a> (void)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function for receiving commands from user.  <a href="#ga328bb6c7a4ed590a8a4eb1b2a60943f1"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__user__interface.html#ga9926a12daaecdbb4d8106ed110510d49">transmit_data</a> (void)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function to output data to user.  <a href="#ga9926a12daaecdbb4d8106ed110510d49"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__user__interface.html#ga56ca2a8f03cbdf960d6928e9a7ad68ba">set_state_output</a> (uint8_t state_id, uint8_t divider)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets state_id state to be output with interrupt frequency divided by 2^(divider-1). Divider=0 turns off output.  <a href="#ga56ca2a8f03cbdf960d6928e9a7ad68ba"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__user__interface.html#gad8c48701618a71f6bcc9ec12d139ba32">reset_output_counters</a> (void)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Reset the output counter such that the output become synchronized.  <a href="#gad8c48701618a71f6bcc9ec12d139ba32"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="var-members"></a>
Variables</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__user__interface.html#ga3f996476795917a4b1ace8c6c5e4b28a">error_signal</a> = 0</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Error signaling vector. If zero no error has occurred.  <a href="#ga3f996476795917a4b1ace8c6c5e4b28a"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="member-group"></a>
Buffer settings</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__user__interface.html#ga739a2a1a0047c98ac1b18ecd25dac092">RX_BUFFER_SIZE</a>&#160;&#160;&#160;20</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__user__interface.html#ga9ab33647617098646990fe263600b650">TX_BUFFER_SIZE</a>&#160;&#160;&#160;60</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__user__interface.html#ga0846b13f494cb412b27a5d30d2e227e6">SINGLE_TX_BUFFER_SIZE</a>&#160;&#160;&#160;10</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__user__interface.html#ga36568984b1040a53e0d7d64d67066de4">MAX_RX_NRB</a>&#160;&#160;&#160;10</td></tr>
<tr><td colspan="2"><h2><a name="member-group"></a>
State output divider limits</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__user__interface.html#ga9f7db6d016bae1297a6e75263dd6d186">MAX_LOG2_DIVIDER</a>&#160;&#160;&#160;14</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__user__interface.html#gabef3d4b97cf2ed7d11401dafdd3fb6ea">MIN_LOG2_DIVIDER</a>&#160;&#160;&#160;0</td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<p>This group contains high level functions for communication between user and system. </p>
<hr/><h2>Define Documentation</h2>
<a class="anchor" id="ga9f7db6d016bae1297a6e75263dd6d186"></a><!-- doxytag: member="external_interface.c::MAX_LOG2_DIVIDER" ref="ga9f7db6d016bae1297a6e75263dd6d186" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define MAX_LOG2_DIVIDER&#160;&#160;&#160;14</td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<a class="anchor" id="ga36568984b1040a53e0d7d64d67066de4"></a><!-- doxytag: member="external_interface.c::MAX_RX_NRB" ref="ga36568984b1040a53e0d7d64d67066de4" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define MAX_RX_NRB&#160;&#160;&#160;10</td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<a class="anchor" id="gabef3d4b97cf2ed7d11401dafdd3fb6ea"></a><!-- doxytag: member="external_interface.c::MIN_LOG2_DIVIDER" ref="gabef3d4b97cf2ed7d11401dafdd3fb6ea" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define MIN_LOG2_DIVIDER&#160;&#160;&#160;0</td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<a class="anchor" id="ga739a2a1a0047c98ac1b18ecd25dac092"></a><!-- doxytag: member="external_interface.c::RX_BUFFER_SIZE" ref="ga739a2a1a0047c98ac1b18ecd25dac092" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define RX_BUFFER_SIZE&#160;&#160;&#160;20</td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<a class="anchor" id="ga0846b13f494cb412b27a5d30d2e227e6"></a><!-- doxytag: member="external_interface.c::SINGLE_TX_BUFFER_SIZE" ref="ga0846b13f494cb412b27a5d30d2e227e6" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define SINGLE_TX_BUFFER_SIZE&#160;&#160;&#160;10</td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<a class="anchor" id="ga9ab33647617098646990fe263600b650"></a><!-- doxytag: member="external_interface.c::TX_BUFFER_SIZE" ref="ga9ab33647617098646990fe263600b650" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define TX_BUFFER_SIZE&#160;&#160;&#160;60</td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="ga87a9b575684eea3d1a804e597236b40f"></a><!-- doxytag: member="external_interface.c::com_interface_init" ref="ga87a9b575684eea3d1a804e597236b40f" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void com_interface_init </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Initialization function for communication interface. </p>

</div>
</div>
<a class="anchor" id="ga328bb6c7a4ed590a8a4eb1b2a60943f1"></a><!-- doxytag: member="external_interface.c::receive_command" ref="ga328bb6c7a4ed590a8a4eb1b2a60943f1" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void receive_command </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Main function for receiving commands from user. </p>
<p>In case the USB is attached (vbus is high) and there is data available the function reads in at most MAX_RX_NRB number of bytes, parses the commands, and execute the command response. In case the functions encounters a invalid header or checksum, it resets the buffer and starts over reading a new command assuming the next byte is a header. The function can split commands over different calls to the function. </p>

</div>
</div>
<a class="anchor" id="gad8c48701618a71f6bcc9ec12d139ba32"></a><!-- doxytag: member="external_interface.c::reset_output_counters" ref="gad8c48701618a71f6bcc9ec12d139ba32" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void reset_output_counters </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Reset the output counter such that the output become synchronized. </p>
<p>Resets all output counters to zero. Since the output rate dividers will always be a power of two. This mean that all outputs will be synchronized independent of their dividers. </p>

</div>
</div>
<a class="anchor" id="ga56ca2a8f03cbdf960d6928e9a7ad68ba"></a><!-- doxytag: member="external_interface.c::set_state_output" ref="ga56ca2a8f03cbdf960d6928e9a7ad68ba" args="(uint8_t state_id, uint8_t divider)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void set_state_output </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>state_id</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>divider</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Sets state_id state to be output with interrupt frequency divided by 2^(divider-1). Divider=0 turns off output. </p>
<p>The function checks that state_id is a valid state ID and that divider is within the allowable range. </p>

</div>
</div>
<a class="anchor" id="ga9926a12daaecdbb4d8106ed110510d49"></a><!-- doxytag: member="external_interface.c::transmit_data" ref="ga9926a12daaecdbb4d8106ed110510d49" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void transmit_data </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Main function to output data to user. </p>
<p>The function calls /#assemble_output_data with its internal output buffer as an argument. This stores the relevant data (single output messages and continual state output) in the buffer. Subsequently the data is written over byte by byte to the USB output buffer. </p>

</div>
</div>
<hr/><h2>Variable Documentation</h2>
<a class="anchor" id="ga3f996476795917a4b1ace8c6c5e4b28a"></a><!-- doxytag: member="external_interface.c::error_signal" ref="ga3f996476795917a4b1ace8c6c5e4b28a" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t <a class="el" href="group__nav__eq.html#ga3f996476795917a4b1ace8c6c5e4b28a">error_signal</a> = 0</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Error signaling vector. If zero no error has occurred. </p>

</div>
</div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Tue Dec 20 2011 12:12:36 for OpenShoe by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>

</body>
</html>
